import { LayerManager } from "../../manager/LayerManager";
import { GameController } from "../../mvc/GameController";
import { GameUI } from "../mainUI/GameUI";
import { ModuleType } from "../common/ModuleType";
import { TweenLite } from "../../../../com/greensock/TweenLite";
type int = number;
//class FlyToNavbarTool
    
    export  class FlyToNavbarTool
    {
        

        public static flyToBackPack(arg1: Object /* flash.display.BitmapData */, arg2: Object /* flash.geom.Point */): void
        {
            var loc1=new Object /* flash.display.Bitmap */(arg1);
            loc1.x = arg2.x;
            loc1.y = arg2.y;
            loc1.width = 36;
            loc1.height = 36;
            LayerManager.topLayer.addChild(loc1);
            var loc2=(GameController.gameui.view as GameUI).getNavbarIconGlobalPoint(ModuleType.Pack);
            TweenLite.to(loc1, FlyToNavbarTool.FlyToTime, {"x": loc2.x + 10, "y": loc2.y + 10, "FlyToNavbarTool.onComplete": FlyToNavbarTool.onComplete, "onCompleteParams":[loc1]});
            return;
        }

        public static flyToPalyer(arg1: Object /* flash.display.BitmapData */, arg2: Object /* flash.geom.Point */): void
        {
            var loc1=null;
            loc1 = new Object /* flash.display.Bitmap */(arg1);
            loc1.x = arg2.x;
            loc1.y = arg2.y;
            LayerManager.topLayer.addChild(loc1);
            var loc2=(GameController.gameui.view as GameUI).getNavbarIconGlobalPoint(ModuleType.Players);
            TweenLite.to(loc1, FlyToNavbarTool.FlyToTime, {"x": loc2.x + 10, "y": loc2.y + 10, "FlyToNavbarTool.onComplete": FlyToNavbarTool.onComplete, "onCompleteParams":[loc1]});
            return;
        }

        public static flyToPet(arg1: Object /* flash.display.BitmapData */, arg2: Object /* flash.geom.Point */): void
        {
            var loc1=new Object /* flash.display.Bitmap */(arg1);
            loc1.x = arg2.x;
            loc1.y = arg2.y;
            LayerManager.topLayer.addChild(loc1);
            var loc2=(GameController.gameui.view as GameUI).getNavbarIconGlobalPoint(ModuleType.Pets);
            TweenLite.to(loc1, FlyToNavbarTool.FlyToTime, {"x": loc2.x + 10, "y": loc2.y + 10, "FlyToNavbarTool.onComplete": FlyToNavbarTool.onComplete, "onCompleteParams":[loc1]});
            return;
        }

        /* internal  */static onComplete(arg1: Object /* flash.display.Bitmap */): void
        {
            if (arg1 && arg1.parent) 
            {
                arg1.parent.removeChild(arg1);
                arg1 = null;
            }
            return;
        }

        public static flyToAnyPoint(arg1: Object /* flash.display.BitmapData */, arg2: Object /* flash.geom.Point */, arg3: Object /* flash.geom.Point */, arg4: Function=null, arg5: int=0, arg6: int=0): void
        {
            var loc1=null;
            (loc1 = new Object /* flash.display.Bitmap */(arg1)).x = arg2.x;
            loc1.y = arg2.y;
            if (!(arg5 == 0) && !(arg6 == 0)) 
            {
                loc1.width = arg5;
                loc1.height = arg6;
            }
            LayerManager.topLayer.addChild(loc1);
            TweenLite.to(loc1, FlyToNavbarTool.FlyToTime, {"x": arg3.x, "y": arg3.y, "FlyToNavbarTool.onComplete": FlyToNavbarTool.onFlyToAnyPointEnd, "onCompleteParams":[loc1, arg4]});
            return;
        }

        /* internal  */static onFlyToAnyPointEnd(arg1: Object /* flash.display.Bitmap */, arg2: Function): void
        {
            if (arg2 != null) 
            {
                if (arg1 != null) 
                {
                    arg2(arg1);
                }
            }
            return;
        }

        public static /* const */FlyToTime: number=1.5;
    }
